﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinJobManage
{
    public partial class jobmanage : Form
    {
        public jobmanage()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 正常关闭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void jobmanage_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("您确定退出程序吗?", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                e.Cancel = false;
            }
            else
            {// 杀掉进程
                e.Cancel = true;
            }
        }


        /// <summary>
        /// 打开 chia 浏览器 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void chiaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("IEXPLORE.EXE", "https://www.chia.net/");
        }
        /// <summary>
        /// 打开 aou 浏览器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("IEXPLORE.EXE", "https://www.aoufil.com/a/guanyuwomen/");
        }

        /// <summary>
        /// 打开启动页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StartToolStripMenuItem_Click(object sender, EventArgs e)
        {
          
        }

        private void jobmanage_Load(object sender, EventArgs e)
        {
            JobMain _jobMain = new JobMain
            {
                Tag = "jobMain"
            };
            bool isExists = false;
            foreach (Form f1 in this.MdiChildren)
            {
                if (f1.Tag.ToString() == "jobMain")
                {
                    isExists = true;
                    f1.Activate();
                    break;
                }
            }
            if (!isExists)
            {
                _jobMain.WindowState = FormWindowState.Normal;
                _jobMain.MdiParent = this;
                _jobMain.MaximizeBox = false;
                _jobMain.Dock = DockStyle.Fill;
                _jobMain.Show();
            }
        }

        private void 密钥获取ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GetKeyshow _jobMain = new GetKeyshow
            {
                Tag = "jobKey"
            };
            bool isExists = false;
            foreach (Form f1 in this.MdiChildren)
            {
                if (f1.Tag.ToString() == "jobKey")
                {
                    isExists = true;
                    f1.Activate();
                    break;
                }
            }
            if (!isExists)
            {
                _jobMain.WindowState = FormWindowState.Normal;
                _jobMain.MdiParent = this;
                _jobMain.MaximizeBox = false;
                _jobMain.Dock = DockStyle.Fill;
                _jobMain.Show();
            }
        }

        private void 寻求帮助ToolStripMenuItem_Click(object sender, EventArgs e)
        {

            HelpMe _jobMain = new  HelpMe
            {
                Tag = "HelpMe"
            };
            bool isExists = false;
            foreach (Form f1 in this.MdiChildren)
            {
                if (f1.Tag.ToString() == "HelpMe")
                {
                    isExists = true;
                    f1.Activate();
                    break;
                }
            }
            if (!isExists)
            {
                _jobMain.WindowState = FormWindowState.Normal;
                _jobMain.MdiParent = this;
                _jobMain.MaximizeBox = false;
                _jobMain.Dock = DockStyle.Fill;
                _jobMain.Show();
            }
        }
    }
}
